package Demo4;
class Animal{
    public String name;
    public Animal(String name ){
        this.name=name;
    }
}
interface IRunning{//接口可以相互继承（拓展）
    void run();
}
interface Iswimming{
    void swim();
}
interface Imove extends IRunning,Iswimming{
    void func();
}
class Dog extends Animal implements IRunning{
    public Dog(String name){
        super(name);
    }
    public void run(){
        System.out.println(name+"正在用四条腿跑");
    }
}
class duck extends Animal implements Imove{
    public void swim(){

    }
    public void run(){

    }
    public void func(){

    }
    public duck(String name){
        super(name);
    }
}

public class Test {
    public static void walk(IRunning iRunning){//只要实现了i=IRunning接口的都可以接收
        iRunning.run();
    }

    public static void main(String[] args) {
        walk(new Dog("旺财"));
    }
}
